package org.davidtrevien.com.imput.application;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.UIManager;

import org.davidtrevien.com.imput.omi.imputomi.ImputOmiCtrl;

public class Application {

	protected JFrame frame;
	
	protected ImputOmiCtrl imputOmiCtrl;
	
	public Application() {
		initComponent();
	}
	
	protected void initComponent() {
		initLookAndFeel();
		
		this.frame = new JFrame("Imput");
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		int width = (int) screenSize.getWidth();
		int height = (int) screenSize.getHeight();
		this.frame.setBounds(0, 0, width, height);
		this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		this.imputOmiCtrl = new ImputOmiCtrl();
		
		this.frame.getContentPane().add(this.imputOmiCtrl.getView());
	}
	
	public void start() {
		this.frame.setVisible(true);
	}
	
	private static void initLookAndFeel() {

		/*try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			return;
		} catch (ClassNotFoundException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (InstantiationException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (IllegalAccessException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (UnsupportedLookAndFeelException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}*/
		
		for (UIManager.LookAndFeelInfo laf : UIManager
				.getInstalledLookAndFeels()) {
			if ("Nimbus".equals(laf.getName())) {
				try {
					UIManager.setLookAndFeel(laf.getClassName());

				} catch (Exception e) {
					// TODO: handle exception
				}
			}
		}
	}
}
